SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


/** Create Stored Procedures **/

CREATE PROCEDURE dbo.[DnnProduct_CDS_Admin_AssetsDelete]
	@ID int
AS
BEGIN
	DECLARE @DRMTYPE INT
	SELECT @DRMTYPE = DRMType FROM [DnnProduct_CDS_Assets] WHERE [ID] = @ID
	
	IF @DRMTYPE = 1
		UPDATE [DnnProduct_CDS_Assets] SET ResourceID = NULL, PackageStatus = 1 WHERE [ID] = @ID
	ELSE
		DELETE
		FROM [DnnProduct_CDS_Assets]
		WHERE [ID] = @ID
END
GO
